﻿using SmartSapce.ServiceLocation;
using SmartSpace.Core;
using SmartSpace.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SmartSpace.WebApp._console.dashboard
{
    public partial class index : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ICoreService service = ServiceLocator.Get<ICoreService>();

            if (SsSite.Application == null)
            {
                _ctlPanelNoApp.Visible = true;
                _ctlPanelAppInfo.Visible = false;

                _ctlEditHostUrl.Text = SsSite.HostUrl;
                _ctlEditName.Text = "SmartSpace Web Application";


                _ctlLinkAdministrator.Text = service.GetUser(SsSite.Application.SuperAdminUserId.Value).Name;
                _ctlLinkAnonymous.Text = "none";
            }
            else
            {
                _ctlPanelNoApp.Visible = false;
                _ctlPanelAppInfo.Visible = true;

                _ctlLinkHostUrl.Text = SsSite.Application.HostUrl;
                _ctlLabelName.Text = SsSite.Application.Name;


                _ctlLinkAdministrator.Text = service.GetUser(SsSite.Application.SuperAdminUserId.Value).Name;
                _ctlLinkAnonymous.Text = SsSite.Application.AnonymousUserId.ToString();
            }
        }
    }
}